<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>鑫立方管理系统</title>
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/common.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/main.css" />
<script type="text/javascript" src="<%=basePath%>js/libs/modernizr.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(function () {
var x = 10;
var y = 20;
$("a.tooltip").mouseover(function (e) {
this.myTitle = this.title;
this.title = "";
var imgTitle = this.myTitle ? "<br />" + this.myTitle + " 产品预览图" : "";
var tooltip = "<div id='tooltip'><img src='" + this.href + "' alt='' width='200' height='200' />" + imgTitle + "</div>";
$("body").append(tooltip);
$("#tooltip")
.css({
"top": (e.pageY + y) + "px",
"left": (e.pageX + x) + "px"
}).show("fast");
}).mouseout(function (e) {
this.title = this.myTitle;
$("#tooltip").remove();
}).mousemove(function (e) {
$("#tooltip").css({
"top": (e.pageY + y) + "px",
"left": (e.pageX + x) + "px"
});
});
})
</script>
<style>
/* ul{margin: 30px auto; width:1440px;}
ul li{float: left; padding-right: 20px; list-style: none;}
ul li img{width: 77px; height: 57px; padding: 6px; border: 1px solid #ccc; background-color:#eee; -webkit-border-radius: 8px;}
*/
#tooltip{
position: absolute;
background-color: #eee;
border: 1px solid #999;
width: 200px;
height: 200px;
-webkit-border-radius: 8px;
font-family: "微软雅黑";
padding: 20px;
} 
</style>
</head>
<body>
  <div class="topbar-wrap white">
    <div class="topbar-inner clearfix">
      <div class="topbar-logo-wrap clearfix">
        <ul class="navbar-list clearfix">
          <li><a class="on" href="#">鑫立方管理系统</a>
          </li>
        </ul>
      </div>
      <div class="top-info-wrap">
        <ul class="top-info-list clearfix">
          <li><a href="/user/logout">退出</a>
          </li>
        </ul>
      </div>
    </div>
  </div>
  <div class="container clearfix">
    <div class="sidebar-wrap">
      <div class="sidebar-content">
        <ul class="sidebar-list">
          <li><a href="#"><i class="icon-font">&#xe003;</i>厂家</a>
            <ul class="sub-menu">
           
           
             <li><a href="<%=basePath + "factory/search"%>"><i class="icon-font">&#xe006;</i>商品管理</a>
              </li>
              
              <li><a href="<%=basePath + "factory/ordersearch"%>"><i class="icon-font">&#xe006;</i>订单确认</a>
              </li>
             
            </ul></li>

        </ul>
      </div>
    </div>
    <!--/sidebar-->
    <div class="main-wrap">

      <div class="crumb-wrap">
        <div class="crumb-list">
          <i class="icon-font"></i><a href="/factory/index">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">商品管理</span>
        </div>
      </div>
      <div class="search-wrap">
        <div class="search-content">
          <form action="/factory/search" method="post">
            <table class="search-tab">
              <tr>
               
              <th width="70">型号:</th>
                <td><input class="common-text" name="type" value="${type }" type="text"></td>
                
                <th width="120">商品状态:</th>
                <td><select name="status">
                    <c:if test="${empty status || status == '-1'}">
                      <option value="-1" selected="selected">全部</option>
                      <option value="0">无货</option>
                      <option value="1">有货</option>
                    </c:if>
                    <c:if test="${status == '0' }">
                      <option value="-1">全部</option>
                      <option value="0" selected="selected">无货</option>
                      <option value="1">有货</option>
                    </c:if>
                    <c:if test="${status == '1' }">
                      <option value="-1">全部</option>
                      <option value="0">无货</option>
                      <option value="1" selected="selected">有货</option>
                    </c:if>
                </select>
                </td>
                <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit" onclick=""></td>
              <tr>
            </table>
          </form>
        </div>
      </div>
      <div class="result-wrap">
       
        <div class="result-content">
          <table class="result-tab" width="100%">
            <tr>
              <th width="3%">No.</th>
            <!--   <th>厂家名称</th>
              <th>主材类型</th> -->
              <th>状态</th>
              <th>图片</th>
              <th>品牌</th>
              <th>型号</th>
              <th>规格</th>
              <th>材质</th>
              <th>单位</th>
              <th>备注</th>
              <th>操作</th>
            </tr>
            <jsp:useBean id="catalogList" class="com.xlf.cache.CatalogList"></jsp:useBean>
            <c:forEach items="${pageRecord.list }" var="f" varStatus="s">
              <tr>
                <td>${s.index + 1}</td>
            <%--     <td>${f.name}</td>
                <td>${catalogList.getName(f.c_id) }</td> --%>
                    <td><c:if test="${f.status == 0 }">
                      <span style="color:red">无货</span>
                    </c:if> <c:if test="${f.status == 1 }">有货</c:if></td>
                  <td><a href="<%=basePath%>upload/${f.pic }" title="" class="tooltip"><img src="<%=basePath%>upload/${f.pic }" border="0" width="36px;" height="36px;" /></a>
                  </td>
                  <td>${f.brand}</td>
                  <td>${f.type}</td>
                  <td>${f.spec}</td>
                  <td>${f.material}</td>
                  <td>${f.unit}</td>
                  <td>${f.productRemark}</td>
                <td>
                  <a href="/factory/productform?id=${f.p_id }"><i class="icon-font">&#xe002;</i>编辑</a>&nbsp;&nbsp;
                </td>

              </tr>
            </c:forEach>
          </table>

          <div class="list-page">
            
            <fmt:parseNumber var="totalPageNumber" value="${pageRecord.totalPage }" type="number"></fmt:parseNumber>
            <span style="float: right"> 
              <c:if test="${pageRecord.totalPage > 10 }">
                <c:set var="totalPageNumber" value="10"></c:set>
              </c:if> <c:if test="${pageRecord.totalPage <= 10 }">
                <c:set var="totalPageNumber" value="${pageRecord.totalPage }"></c:set>
              </c:if> 
              <c:forEach var="item" varStatus="vs" begin="1" end="${totalPageNumber }">
                  <a href="search?type=${type }&status=${status }&page=${vs.index }">${vs.index }</a>
              </c:forEach>
            </span>
            <span> 共 ${pageRecord.totalRow } 条 ${pageRecord.pageNumber }/${pageRecord.totalPage } 页 </span>
          </div>
        </div>
      </div>
    </div>
    <!--/main-->
  </div>
</body>
</html>
